package com.riteny.common.schedule.config;

import com.riteny.common.schedule.service.ScheduleAgentService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * @author Riteny
 * <p>
 * 啓動類，導入該包時，自動初始化相關配置和對應的服務類
 * 2021/9/13  11:22
 */
@Configuration
public class ScheduleTaskConfiguration {

    @Bean
    public ScheduleAgentService scheduleAgentService(ThreadPoolTaskScheduler threadPoolTaskScheduler) {
        return new ScheduleAgentService(threadPoolTaskScheduler);
    }

    @Bean
    public ThreadPoolTaskScheduler threadPoolTaskScheduler() {
        return new ThreadPoolTaskScheduler();
    }
}
